
function trim(str)
{
    return str.replace(/(^\s*)|(\s*$)/g,"");
}

function comment(val)
{ 
	 var menu_id =document.getElementById("menu_id").value;	
	 var order_no =document.getElementById("order_no_"+val).value;	
	 var cust_id =document.getElementById("cust_id_"+val).value;
	 window.location.href="commentIndex.jsp?menu_id="+menu_id+"&order_no="+order_no+"&cust_id="+cust_id;	

}

function subForm()
{
  if(trim(document.getElementById("content").value)=="")
  {
  	alert("请输入评论内容！"); 
	document.getElementById("content").focus();
  	return;  
  } 
  
  var info_level = document.addForm.info_level;
  var level_flag =0;
  for(var i=0;i<info_level.length;i++)
  {
       if(info_level[i].checked) 
       {
         level_flag  =1;
         break;       
       } 
   }
   
   if(level_flag==0)
   {
      alert("请选择评价级别！");
  	  return;  
   } 
 
  var same_num = document.getElementById('same_num').value;
   
   if(same_num=='')
   {
      alert("请选择商品与描述相符星级！");
  	  return;  
   } 
  var service_num = document.getElementById('service_num').value;
   
   if(service_num=='')
   {
      alert("请选择卖家的服务态度星级！");
  	  return;  
   } 
  var speed_num = document.getElementById('speed_num').value;
   
   if(speed_num=='')
   {
      alert("请选择卖家发货的速度星级！");
  	  return;  
   }  
   
  document.addForm .submit();

}